import { request } from './request'

// 认证相关API
const authAPI = {
  // 管理员登录
  login: (data) => request('/admin/user/v1/login', {
    method: 'POST',
    data
  }),
  
  // 检查登录状态
  checkAuth: () => {
    const token = localStorage.getItem('admin_token')
    return !!token
  },
  
  // 退出登录
  logout: () => {
    localStorage.removeItem('admin_token')
    localStorage.removeItem('admin_user')
    window.location.reload()
  },
  
  // 获取当前用户信息
  getCurrentUser: () => {
    return localStorage.getItem('admin_user')
  }
}

export { authAPI }